package com.zy.web.controller.sys;

import com.zy.pojo.vos.common.ResultVo;
import com.zy.web.utils.ResultUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.zy.service.sys.CityService;
import com.zy.utils.tree.BaseTree;
import com.zy.web.controller.base.BaseController;

import java.io.Serializable;

@RequestMapping({"sys/city","m/sys/city"})
@Controller
public class CityController extends BaseController {

	@Autowired
	private CityService cityService;

	@RequestMapping(value = "cityTree")
	@ResponseBody
	public BaseTree cityTree() {
		return cityService.cityTree();
	}

	/**
	 * 获取所有城市
	 * @Param 	cityName 城市名称
	 * @return
	 */
	@RequestMapping(value = "front/selectAllCity")
	@ResponseBody
	public ResultVo selectAllCity(String cityName){
		try {
			return ResultUtil.success((Serializable) this.cityService.listAllCity(cityName));
		} catch (Exception e){
			return ResultUtil.error(log,e);
		}
	}
}